import re  
import urllib.request
url = "http://www.baidu.com/"  
content = urllib.request.urlopen(url).read()  
title = re.findall(b'<title>(.*?)</title>', content)
print(str(title[0],'utf-8'))